package J11_9.J11_8.operation;

import J11_9.J11_8.book.BookList;

import java.util.Scanner;

public class SelectBook implements IOperation {

    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");

        Scanner in = new Scanner(System.in);
        System.out.println("请输入书名");
        String name = in.nextLine();
        for (int i = 0; i < bookList.getBookCount(); i++) {
            if(bookList.getBooks(i).getName().equals(name)){
                System.out.println(bookList.getBooks(i));;
                return;
            }
        }
        System.out.println("找不到这本书");
    }


}
